package org.summer.generator.writer.impl;

import org.summer.generator.log.Logger;
import org.summer.generator.log.LoggerManager;
import org.summer.generator.vo.MethodInfo;
import org.summer.generator.writer.AbstractJavaFileWriter;

/**
 * 数据库操作服务层接口文件写入处理类
 */
public class ServiceFileWriter extends AbstractJavaFileWriter {
    private static final Logger log = LoggerManager.getLogger(ServiceFileWriter.class);
    @Override
    public void execute() {
        String packageName = project.getServicePackageName();
        String classDefinition = getInterfaceDefinition(packageName,writer.getServiceParentInterface());
        channel.writerNewline(getPackageDefinition(packageName));
        channel.writerEmptyLine();
        channel.writerNewline(table.getEntityImportStr());
        importSet.forEach(channel::writerNewline);
        channel.writerEmptyLine();
        channel.writerNewline(CLASS_REMARK.formatted(table.getRemark() + ",服务层数据处理接口"));
        channel.writer(classDefinition);
        channel.writerEmptyLine();
        channel.writer(BLOCK_END);
    }

    @Override
    protected void writerMethod(MethodInfo method, String previousObject, String loadMethodName) {
    }
}
